/*
 * JNIUpstream.h
 *
 *  Created on: 2012/01/02
 *      Author: nobnak
 */

#ifndef JNIUPSTREAM_H_
#define JNIUPSTREAM_H_

#include <jni.h>
#include "IReadable.h"

class JNIUpstream: public IWritable<unsigned char> {
public:
	JNIUpstream(JavaVM *vm);
	virtual ~JNIUpstream();
	void setListener(JNIEnv *env, jobject callbackListener);
	void deleteListener(JNIEnv *env);
	// IWritable
	void write(unsigned char* src, int n);
	void end();
private:
	JavaVM *vm;
	jobject callbackListener;

	JNIEnv *getEnv();
};

#endif /* JNIUPSTREAM_H_ */
